/*
 This file is part of Musimage, a project which makes possible listen to music
 and, at the same time, watch pictures related with that music.
 Copyright (C) 2006  David Garcia Narbona 

 Musimage is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 Musimage is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Musimage; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
package broker;

public class ImageResearchThreadingExecution extends Thread {

	// ** Atributos **///////////////////////////////////////
	private DataBaseManager dataBaseManager;

	private ProcessClientRequest processClientRequestReference;

	private String songName;

	private String autorName;

	private int numberThread;

	// //////////////////////////////////////////////////////

	// ** Metodos **////////////////////////////////////////

	// Constructor
	public ImageResearchThreadingExecution(DataBaseManager _dataBaseManager,
			ProcessClientRequest _processClientRequest, String _songName,
			String _autorName, int linkParameter, int _id) {

		dataBaseManager = _dataBaseManager;
		processClientRequestReference = _processClientRequest;

		songName = _songName;
		autorName = _autorName;

		dataBaseManager.setLinkParameter(linkParameter);

		numberThread = _id;
	}

	public void run() {

		if (!dataBaseManager.findSong(songName, autorName)) {

			processClientRequestReference.requestRDFServer(songName, autorName);
		} else {
			processClientRequestReference.setMessageStructure(numberThread,
					dataBaseManager.getURLs());
		}
	}
	// //////////////////////////////////////////////////////
}
